﻿using System;
using System.Collections.Generic;

namespace HlELock.Core
{
    public interface IUsbHid
    {

        /// <summary>
        /// 蜂鸣器
        /// </summary>
        void Beep();
        IntPtr DeviceHandle { get; }
        string Path { get; set; }
        ushort PID { get; set; }
        ushort VER { get; set; }
        ushort VID { get; set; }
        string ProductName { get; set; }
        string Manufacturer { get; set; }

        /// <summary>
        /// 接收消息
        /// </summary>
        event Action<byte[]> OnReceiveMessaged;

        /// <summary>
        /// 清除事件
        /// </summary>
        void ClearEvents();
        void Dispose();

        /// <summary>
        /// 打开设备
        /// </summary>
        bool Open();

        bool OpenWithPath();

        /// <summary>
        /// 写入硬件信息
        /// </summary>
        /// <returns></returns>
        bool RewriteInfo();

        /// <summary>
        ///发送二进制指令
        /// </summary>
        /// <param name="datas"></param>
        /// <returns></returns>
        byte[] SendMessage(byte[] datas, bool hasReturn = false);
        /// <summary>
        /// 发送16进制字符串指令
        /// </summary>
        /// <param name="hexString"></param>
        /// <returns></returns>
        byte[] SendMessage(string hexString, bool hasReturn = false);

        string ToString();
    }
}